﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class news : System.Web.UI.Page
{
    BLL.NewsBll nb = new BLL.NewsBll();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindCategories();
            BindNewsContent();
        }
    }

    private void BindCategories()
    {
        DataTable table = nb.GetNewsCategory();
        rep_NewsCategory.DataSource = table;
        rep_NewsCategory.DataBind();
    }

    private void BindNewsContent()
    {
        //int categoryId = int.Parse(Request.QueryString["category"]);
        int id = int.Parse(Request.QueryString["id"]);

        Model.News news = nb.GetNewsContent(id);
        lb_currentCategory.Text = news.CategoryName;

        lb_Time.Text = news.Time;
        lb_Title.Text = news.Title;
        lb_Contnet.Text = news.Content;
        lb_Author.Text = news.Author;
    }
}
